package org.dromara.neutrinoproxy.client;


import cn.hutool.core.util.StrUtil;
import org.dromara.neutrinoproxy.client.mini.DesktopService;
import org.dromara.neutrinoproxy.client.mini.MyTrayIcon;
import org.dromara.neutrinoproxy.client.mini.MyWindow;
import org.noear.solon.Solon;

public class SwingMain {
    public static void main(String[] args) {

        // 启动图标
        DesktopService.getInstance().start();

        Solon.start(SwingMain.class, args, app -> {
            setAlias("neutrino.proxy.client.serverIp", "serverIp");
            setAlias("neutrino.proxy.client.serverPort", "serverPort");
            setAlias("neutrino.proxy.client.sslEnable", "sslEnable");
            setAlias("neutrino.proxy.client.jksPath", "jksPath");
            setAlias("neutrino.proxy.client.keyStorePassword", "keyStorePassword");
            setAlias("neutrino.proxy.client.licenseKey", "licenseKey");
        });
    }

    /**
     * 别名处理，支持较短的启动参数名
     * @param key
     * @param alias
     */
    private static void setAlias(String key, String alias) {
        String val = Solon.cfg().argx().get(alias);
        if (StrUtil.isNotBlank(val)) {
            Solon.cfg().put(key, val);
        }
    }
}